import mixins from './mixins';
import axios from 'axios'
import qs from 'qs'
import { Toast } from 'mint-ui';
const install = function(Vue,options){

  let methods = {};

  methods.tt = function(){
    console.log('aaa')
    return 123;
  }

  Object.assign(axios.defaults,{
    // baseURL: 'http://vue.music.php/api/',
    baseURL: 'http://192.168.51.231:8101/api/',
    timeout: 1000,
    headers: {'X-Requested-With': 'XMLHttpRequest'},
  });

  axios.interceptors.request.use(function (config) {
    // 在发送请求之前做些什么
    return config
  }, function (error) {
    // 对请求错误做些什么
    return Promise.reject(error);
  });

  methods.http = axios;

  methods.toast = Toast;

  for(let i in methods){
    Vue[i] = methods[i];
    Vue.prototype['$'+i] = methods[i];
  }

  Vue.mixin(mixins);

};

export default install;
